package com.example.rubbish.Utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.widget.Toast;

public class ShareHelper {
    private Context mContext;

    public  ShareHelper(){
    }

    public  ShareHelper(Context context){
        this.mContext=context;
    }

    public void save(boolean autoSpeak){
        SharedPreferences sp = mContext.getSharedPreferences("auto",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sp.edit();
        editor.putBoolean("autoSpeak",autoSpeak);
        editor.commit();
        Toast.makeText(mContext,"设置更改成功",Toast.LENGTH_SHORT).show();
    }

    public boolean getSettingSpeak() {
        boolean autoSpeak;
        SharedPreferences sp = mContext.getSharedPreferences("auto",Context.MODE_PRIVATE);
        autoSpeak= sp.getBoolean("autoSpeak",false);
        return  autoSpeak;
    }

}
